package de.slothsoft.commons.swing.util;

import java.awt.Component;

import javax.swing.JFrame;

import de.slothsoft.commons.swing.ConsumingGlassPane;

public final class GlassPaneUtil {

	public static void lockWindow(JFrame frame) {
		lockWindowWithPane(frame, new ConsumingGlassPane());
	}

	public static void lockWindowWithPane(JFrame frame, Component glassPane) {
		frame.setGlassPane(glassPane);
		frame.getGlassPane().setVisible(true);
		frame.getGlassPane().requestFocusInWindow();
	}

	public static void unlockWindow(JFrame frame) {
		frame.getGlassPane().setVisible(false);
	}

	private GlassPaneUtil() {
		// How many roads must a man walk down...
	}

}
